/*
 * Copyright (C) 2014-2020 Arpit Khurana <arpitkh96@gmail.com>, Vishal Nehra <vishalmeham2@gmail.com>,
 * Emmanuel Messulam<emmanuelbendavid@gmail.com>, Raymond Lai <airwave209gt at gmail.com> and Contributors.
 *
 * This file is part of Amaze File Manager.
 *
 * Amaze File Manager is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package com.example.filemanager.files;

import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Build;
import android.widget.EditText;
import android.widget.Toast;

import androidx.annotation.NonNull;
import com.amaze.filemanager.fileoperations.filesystem.OpenMode;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.security.GeneralSecurityException;

/**
 * Provides useful interfaces and methods for encryption/decryption
 *
 * @author Emmanuel on 25/5/2017, at 16:55.
 */
public class EncryptDecryptUtils {

  public static final String DECRYPT_BROADCAST = "decrypt_broadcast";
  private static final Logger LOG = LoggerFactory.getLogger(EncryptDecryptUtils.class);
  /**
   * Queries database to map path and password. Starts the encryption process after database query
   *
   * @param path the path of file to encrypt
   * @param password the password in plaintext
   * @throws GeneralSecurityException Errors on encrypting file/folder
   * @throws IOException I/O errors on encrypting file/folder
   */
  public static void startEncryption(
      Context c, final String path, final String password, Intent intent)
      throws GeneralSecurityException, IOException {

  }


  public interface EncryptButtonCallbackInterface {
    /**
     * Callback fired when user has entered a password for encryption Not called when we've a master
     * password set or enable fingerprint authentication
     *
     * @param password the password entered by user
     */
    default void onButtonPressed(@NonNull Intent intent, @NonNull String password)
        throws GeneralSecurityException, IOException {}
  }

  public interface DecryptButtonCallbackInterface {
    /** Callback fired when we've confirmed the password matches the database */
    default void confirm(@NonNull Intent intent) {}

    /** Callback fired when password doesn't match the value entered by user */
    default void failed() {}
  }
}
